---
title: Message
api: Message
---

## Description

<Summary/>

_Message_ in itself is not an event. Instead, it's a convenient wrapper of an event series including a leading [MessageStart](/reference/api/MessageStart) event, an ending [MessageEnd](/reference/api/MessageEnd) event and one or more [Data](/reference/api/Data) events in between for the message body (or payload).

When a filter callback needs a _Message_, such as [handleMessage](/reference/Configuration/handleMessage), it'll wait and collect all those events composing a full message and combine them into a _Message_ object for handling by the script. When a filter is to output a _Message_, it decomposes the object into a series of events representing the original full message.

## Constructor

<Constructor/>

## Properties

<Properties/>

## Example

``` js
new Message(
  {
    status: 200,
    statusText: 'OK',
    headers: {
      'content-type': 'text/plain'
    }
  },
  'Hello!'
)
```

## See Also

* [MessageStart](/reference/api/MessageEnd)
* [MessageEnd](/reference/api/MessageEnd)
* [Data](/reference/api/Data)
* [StreamEnd](/reference/api/StreamEnd)
* [handleMessage()](/reference/api/Configuration/handleMessage)
* [replaceMessage()](/reference/api/Configuration/replaceMessage)
